FROM alpine:3.16 as build
RUN apk add --no-cache \
		alpine-sdk \
		linux-headers \
		libjpeg-turbo-dev \
		libevent-dev \
		libbsd-dev \
		libgpiod-dev

WORKDIR /build/ustreamer/
COPY . .
RUN make -j5 WITH_GPIO=1

FROM alpine:3.16 as run

RUN apk add --no-cache \
		libevent \
		libjpeg-turbo \
		libevent \
		libgpiod \
		libbsd \
		v4l-utils

WORKDIR /ustreamer
COPY --from=build /build/ustreamer/src/ustreamer.bin ustreamer

RUN wget https://raw.githubusercontent.com/pikvm/kvmd/master/configs/kvmd/edid/v3-hdmi.hex -O /edid.hex
COPY pkg/docker/entry.sh /

EXPOSE 8080
ENTRYPOINT ["/entry.sh"]
CMD ["--dv-timings", "--format", "UYVY"]

# vim: syntax=dockerfile
